/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package managedBeans;

import entities.EstatusTiempo;
import entities.Tarea;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import servicios.ServicioTarea;

/**
 *
 * @author curso
 */
@ManagedBean
@RequestScoped
public class TareaBean {

    private Tarea tarea;
    @EJB
    private ServicioTarea servicioTarea;
    /** Creates a new instance of TareaBean */
    public TareaBean() {
    }
    
    public String guardarTarea(){
        servicioTarea.guardarTarea(tarea);
        return "index.faces";
    }
    
    public String modificar(){
        servicioTarea.modificarTarea(tarea);
        return "index.faces";
    }
    
    public List<Tarea> verTareas(){
        return servicioTarea.verTodas();
    }
    
    public ServicioTarea getServicioTarea() {
        return servicioTarea;
    }

    public void setServicioTarea(ServicioTarea servicioTarea) {
        this.servicioTarea = servicioTarea;
    }
    
    public Tarea getTarea() {
        return tarea;
    }

    public void setTarea(Tarea tarea) {
        this.tarea = tarea;
    }
        
    public List<EstatusTiempo> verStatus(){
        List l = servicioTarea.verStatus();
        return l;
    }
    
    @PostConstruct
    public void inicializar(){
        tarea = new Tarea();
    }
}
